<?php 
if($tipoDoc == 109 && ( substr($documentos[0][$modelo]['numero_documento'], 0,3)=='001')){
	echo $html->css('guia_cp.css'); 
} else {
	echo $html->css('documento_venta.css');
}
?>
<?php echo $form->hidden('done', array('value'=>$done));
   // print_r($documentos);die('');
  $impuesto = $session->read('Usuario.Empresa.igv')/100+1;
?>
<div class="menu">
<h1><?php echo $titulo;?></h1>
    <p>
        Por tratarse de un reporte para documento preimpreso no se  muestra el contenido del reporte.
        Se muestra a continuación una relación de los documento a imprimir, este listado no forma parte
        de la impresión, solo se imprimirán los datos del formato correspondiente.
    </p>
<?php if ($tipoDoc == 140):   ?><!-- Listado de comprobante de percepcion-->
<table border="1" cellpadding="3" cellspacing="0" width="100%" align="center">
	<tr>
		<th>CONTROL</th>
		<th>NUMERO</th>
		<th>FECHA EMISION</th>
		<th>CLIENTE</th>
		<th>VENDEDOR</th>
		<th>IMPORTE</th>
		<th>PERCEPCION</th>
		<th>TOTAL</th>
	</tr>
<?php  foreach ($documentos as $documento): ?>
	<tr>
		<td><?php echo $documento[$modelo]['numero_control']; ?></td>
		<td><?php echo $documento[$modelo]['numero_documento']; ?></td>
		<td><?php echo $time->format('d/m/Y',$documento[$modelo]['fecha_emision']); ?></td>
		<td><?php echo $documento[$modelo]['nombre_cliente']; ?></td>
		<td><?php echo $documento[$modelo]['nombre_vendedor']; ?></td>
		<td><?php echo $number->precision($documento[$modelo]['suma_importe_total'],2); ?></td>
		<td><?php echo $number->precision($documento[$modelo]['suma_importe_percepcion'],2); ?></td>
		<td><?php echo $number->precision($documento[$modelo]['suma_importe_cobranza'],2); ?></td>
	</tr>
<?php endforeach; ?>
	</table>
<?php endif;?>

<?php if ($tipoDoc == 120):   ?><!-- Listado de comprobante de percepcion-->
<table border="1" cellpadding="3" cellspacing="0" width="100%" align="center">
	<tr>
		<th>CONTROL</th>
		<th>NUMERO</th>
		<th>FECHA EMISION</th>
		<th>PROVEEDOR</th>
		<th>IMPORTE</th>
		<th>RETENCION</th>
		<th>PAGADO</th>
	</tr>
<?php  foreach ($documentos as $documento): ?>
	<tr>
		<td><?php echo $documento[$modelo]['numero_control']; ?></td>
		<td><?php echo $documento[$modelo]['numero_documento']; ?></td>
		<td><?php echo $time->format('d/m/Y',$documento[$modelo]['fecha_emision']); ?></td>
		<td><?php echo $documento[$modelo]['nombre_proveedor']; ?></td>
		<td><?php echo $number->precision($documento[$modelo]['suma_importe_total_mn'],2); ?></td>
		<td><?php echo $number->precision($documento[$modelo]['suma_retencion_mn'],2); ?></td>
		<td><?php echo $number->precision($documento[$modelo]['suma_importe_total_mn']-$documento[$modelo]['suma_retencion_mn'],2); ?></td>
	</tr>
<?php endforeach; ?>
	</table>
<?php endif;?>

<?php if ($tipoDoc == 101 || $tipoDoc == 103 || $tipoDoc == 107 || $tipoDoc == 108):  ?>
<!-- Listado de documentos de ventas-->
<table border="1" cellpadding="3" cellspacing="0" width="100%" align="center">
    <tr>
            <th>CONTROL</th>
            <th>NUMERO</th>
            <th>FECHA</th>
            <th>CLIENTE</th>
            <th>VENDEDOR</th>
            <th>TOTAL</th>
    </tr>
    <?php  foreach ($documentos as $documento): ?>
    <tr>
        <td><?php echo $documento[$modelo]['numero_control']; ?></td>
        <td><?php echo ($codigoDocumento!=140?$documento['CodigoDocumento']['simbolo']:'CP.').$documento[$modelo]['numero_documento']; ?></td>
        <td><?php echo $time->format('d/m/Y',$documento[$modelo]['fecha_emision']); ?></td>
        <td><?php echo $documento[$modelo]['nombre_cliente']; ?></td>
        <td><?php echo $codigoDocumento!=140?$documento[$modelo]['nombre_vendedor']:'&nbsp;'; ?></td>
        <td align="right">
            <?php echo $number->format($codigoDocumento!=140?($documento[$modelo]['suma_importe_total']+$documento[$modelo]['suma_percepcion']):$documento[$modelo]['suma_importe_percepcion'],
                    array('places'=>2,
                        'before'=>$codigoDocumento!=140?$documento['Moneda']['simbolo']:'',
                        'thousands'=>'')); ?>
        </td>
    </tr>
    <?php endforeach; ?>
</table>
<?php endif;?>
    
<?php if ($tipoDoc == 109):   ?><!-- Listado de guias de remision-->
<table border="1" cellpadding="3" cellspacing="0" width="100%" align="center">
    <tr>
            <th>CONTROL</th>
            <th>TIPO</th>
            <th>NRO DOCUMENTO</th>
            <th>NOMBRE CLIENTE</th>
            <th>DIR. ENTREGA</th>
            <th>FECHA ENTREGA</th>
            <th>VEHICULO</th>
    </tr>
<?php  foreach ($documentos as $documento): ?>
    <tr>
        <td><?php echo $documento[$modelo]['numero_control']; ?></td>
        <td><?php if($documento[$modelo]['automatico']==1) { echo 'Automatico (Rep.)';}else { echo 'Manual (Dist.)';} ?></td>
        <td><?php echo $documento[$modelo]['numero_documento']; ?></td>
        <td><?php echo $documento[$modelo]['nombre_cliente']; ?></td>
        <td><?php echo $documento[$modelo]['direccion_cliente']; ?></td>
        <td><?php echo $time->format('d/m/Y',$documento[$modelo]['fecha_emision']); ?></td>
        <td><?php echo $documento[$modelo]['placa_vehiculo']; ?></td>
    </tr>
    <?php endforeach; ?>
</table>
<?php endif;?>

<?php if ($tipoDoc == 999):   ?><!-- Listado de guias de remision-->
<table border="1" cellpadding="3" cellspacing="0" width="100%" align="center">
    <tr>
            <th width="9%">CONTROL</th>
            <th width="16%">MATRICULA</th>
            <th width="53%">GUIAS  DE REMISION</th>
            <th width="12%">DESTINO</th>
            <th width="10%">PESO BRUTO</th>
    </tr>
<?php  foreach ($documentos as $documento): ?>
    <tr>
        <td><?php echo $documento[$modelo]['numero_control']; ?></td>
        <td><?php echo $documento['Vehiculo']['matricula']; ?></td>
        <td><?php echo $documento[$modelo]['guias']; ?></td>
        <td><?php echo $documento['Destino']['descripcion_corta']; ?></td>
        <td><?php echo $documento[$modelo]['peso_total']; ?></td>
    </tr>
    <?php endforeach; ?>
</table>
<?php endif;?>
<div class="clear"></div>
</div>
<!-- COMIENZO MOSTRAR LA IMPRESION DE LOS DOCUMENTOS -->
<?php
$i=0;
foreach($documentos as $documento){
	
$suma_cantidad=0;
$suma_peso =0;
$suma_total=0;
?>

<div id="documentoVenta" style="page-break-after:always">
<div id="topMargin"></div>

<!--///////////////////////////////////////// IMPRESION DE DOCUMENTOS DE VENTAS ////////////////////////////////////-->
<?php if ($tipoDoc == 101 && substr($documento[$modelo]['numero_documento'], 0,3)=='991' ){  ?>
<table width="100%"  id="exportar">
  <tr>
    <td colspan="2"></td>
    <td width="24%">&nbsp;</td>
    <td width="19%"><?php echo $documento[$modelo]['numero_documento'];?></td>
  </tr>
    <tr>
    <td colspan="4" >&nbsp;</td>
  </tr>
    <tr>
    <td colspan="4" >&nbsp;</td>
  </tr>    
    <tr>
    <td colspan="4" >&nbsp;</td>
  </tr>
    <tr>
    <td colspan="4" >&nbsp;</td>
  </tr>
  <tr>
    <td colspan="4" >&nbsp;</td>
  </tr>
  <tr>
    <td width="26%" ><?php echo $documento[$modelo]['nombre_cliente'];?></td>
    <td width="31%" align="left">&nbsp;</td>
    <td><?php echo $documento['Cliente']['Tercero']['ruc'];?></td>
    <td><?php echo $documento[$modelo]['fecha_emision'];?></td>
  </tr>
    <tr>
    <td colspan="4" >&nbsp;</td>
  </tr>
  <tr>
    <td></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3"><?php echo $documento['DocumentoVenta']['direccion_cliente'];?></td>
    <td><?php echo $documento['Factura']['numero_pedido'];?></td>
  </tr>
  <tr>
    <td width="26%" ><?php echo $documento[$modelo]['loc_cliente'];?></td>
    <td width="31%" align="left">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
    <tr>
    <td colspan="4" >&nbsp;</td>
  </tr>
  <tr>
    <td><?php echo $documento['Factura']['incoterms'];?></td>
    <td><?php echo $documento['Factura']['cond_pago'];?></td>
    <td><?php echo $documento['Factura']['fecha_contrato'];?></td>
    <td><?php echo $documento['Factura']['fecha_embarque'];?></td>
  </tr>
    <tr>
    <td colspan="4" >&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php echo $documento['Factura']['doc_embarque'];?></td>
    <td><?php echo $documento['Factura']['lugar_embarque'];?></td>
    <td><?php echo $documento['Factura']['lugar_llegada'];?></td>
    <td><?php echo $documento['Factura']['transporte'];?></td>
  </tr>
  <tr>
    <td></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<div style="height:360pt;">
<table width="100%" border="0">
<?php 
foreach($documento['DocumentoVentaDetalle'] as $detalle){ //detalles de los documento de ventas
?>
<tr>
<td width="7%"><?php echo $detalle['Producto']['codigo']; ?></td>
<td width="6%" align="right"><?php echo number_format( $detalle['cantidad'],2,'.','');?></td>
<td width="10%" align="center"><?php echo $detalle['Producto']['UnidadMedida']['simbolo'];?></td>
<td width="29%"><?php echo $detalle['descripcion_producto'];?></td>
<td width="12%" align="right"><?php echo $detalle['Producto']['peso_neto']*$detalle['cantidad'];?></td>
<td width="12%" align="right"><?php echo $detalle['Producto']['peso']*$detalle['cantidad'];?></td>
<td width="12%" align="right"><?php echo number_format( $detalle['valor_venta_unidad'],2,'.','');?></td>
<td width="12%" align="right"><?php echo number_format( $detalle['importe_total'],2,'.','');?></td>
</tr>
<?php 
$suma_cantidad += $detalle['cantidad'];
};?>
</table>
</div>
<table width="100%" border="0">
<tr>
<td width="10%">&nbsp;</td>
<td colspan="2"><?php echo $suma_cantidad; ?></td>
<td width="15%" align="right"><?php echo $documento['Factura']['incoterms'];?></td>
<td width="9%" align="right"><?php echo $documento['Moneda']['simbolo'];?></td>
<td width="12%" align="right"><?php echo $documento[$modelo]['suma_importe_total'];?></td>
</tr>
<tr>
<td width="10%">&nbsp;</td>
<td width="42%">&nbsp;</td>
<td width="12%" align="right">&nbsp;</td>
<td width="15%">&nbsp;</td>
<td width="9%" align="right">&nbsp;</td>
<td width="12%" align="right">&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td><?php echo $documento[$modelo]['texto']; ?> (S.E.U.O.)</td>
  <td align="right">&nbsp;</td>
  <td>&nbsp;</td>
  <td colspan="2" align="right"><?php   e(strtoupper($session->read('Usuario.usuario')));   ?>
    / <?php echo $time->format('h:i:s',$documento[$modelo]['fecha_impresion']);?></td>
  </tr>
</table>
<?php } ?>
<?php if (($tipoDoc == 101 || $tipoDoc == 103 || $tipoDoc == 107 || $tipoDoc == 108) && substr($documento[$modelo]['numero_documento'], 0,3)!='991'){  ?>
<?php if ($tipoDoc == 101 || $tipoDoc == 103 ){  ?>

<table width="100%"  id="cabecera">
  <!-- cabecera , info del cliente-->
  <tr>
    <td width="7%"></td>
    <td width="24%"><?php echo $documento['Cliente']['codigo'];?></td>
    <td width="47%"><?php
			switch ($codigoDocumento){
				case 101:
					echo $documento['Cliente']['Tercero']['ruc'];
					break;
				case 103:
					echo $documento['Boleta']['numero_documento'];
					break;				
			}?></td>
    <td colspan="2"><?php if($tipoDoc == 103 && $documento['Boleta']['transferencia_gratuita']== 1 ){ echo 'TRANSFERENCIA GRATUITA';}?></td>
    </tr>
  <tr>
    <td ></td>
    <td colspan="3"><?php echo $documento[$modelo]['nombre_cliente'];?></td>
    <td width="19%" >&nbsp;</td>
  </tr>
  <tr>
    <td ></td>
    <td colspan="3" align="left"><?php echo $documento['DocumentoVenta']['direccion_cliente'];?> / <?php echo $documento[$modelo]['loc_cliente'];?></td>
    <td><?php echo $documento[$modelo]['numero_documento'];?></td>
  </tr>
  <tr>
    <td></td>
    <td colspan="2"><?php if($documento[Cliente]['direccion_entrega']!=''){
			 	echo 'Pto. Ent: '.$documento[Cliente]['direccion_entrega'];
			}else{
				echo 'Pto. Ent: '.$documento[Cliente]['referencia'];
				}?></td>
    <td colspan="2"><?php 
			if($tipoDoc == 103 && $documento['Boleta']['documento_referencia_id']!= 0 ){ echo 'Ref: '.$documento['Boleta']['DocumentoReferencia']['codigo_documento_id'].'-'.$documento['Boleta']['DocumentoReferencia']['numero_documento'];}			
		?></td>
    </tr>
</table>
<?php } ?>
<?php if ($tipoDoc == 107 || $tipoDoc == 108){  ?>
<table width="100%"  id="cabecera2">
  <!-- cabecera , info del cliente-->
  <tr>
    <td width="7%"></td>
    <td width="43%"><?php echo $documento['Cliente']['codigo'];?></td>
    <td width="17%"><?php
			switch ($codigoDocumento){				
				case 107:
					if($documento['NotaCredito']['DocumentoReferencia']['codigo_documento_id']==103)
						echo 'DNI:'.$documento['Cliente']['Tercero']['numero_documento'];
					if($documento['NotaCredito']['DocumentoReferencia']['codigo_documento_id']==101)
						echo $documento['Cliente']['Tercero']['ruc'];
					break;
				case 108:
					if($documento['NotaDebito']['DocumentoReferencia']['codigo_documento_id']==103)
						echo 'DNI:'.$documento['Cliente']['Tercero']['numero_documento'];
					if($documento['NotaDebito']['DocumentoReferencia']['codigo_documento_id']==101)
						echo $documento['Cliente']['Tercero']['ruc'];
					break;
			}?></td>
    <td width="14%">&nbsp;</td>
    <td width="19%">&nbsp;</td>
  </tr>
  <tr>
    <td ></td>
    <td><?php echo $documento[$modelo]['nombre_cliente'];?></td>
    <td>&nbsp;</td>
    <td >&nbsp;</td>
    <td >&nbsp;</td>
  </tr>
  <tr>
    <td ></td>
    <td align="left"><?php echo $documento['DocumentoVenta']['direccion_cliente'];?></td>
    <td align="left"><?php
			switch ($codigoDocumento){
				case 107:
					echo $documento['NotaCredito']['DocumentoReferencia']['CodigoDocumento']['simbolo'].$documento['NotaCredito']['DocumentoReferencia']['numero_documento'];
					break;
				case 108:
					echo $documento['NotaDebito']['DocumentoReferencia']['CodigoDocumento']['simbolo'].$documento['NotaDebito']['DocumentoReferencia']['numero_documento'];
					break;
			}?></td>
    <td>&nbsp;</td>
    <td><?php echo $documento[$modelo]['numero_documento'];?></td>
  </tr>
  <tr>
    <td></td>
    <td><?php echo $documento[$modelo]['loc_cliente'];?></td>
    <td><?php
			switch ($codigoDocumento){
				case 107:
					echo  $time->format('d/m/Y',$documento['NotaCredito']['DocumentoReferencia']['fecha_emision']);
					break;
				case 108:
					echo  $time->format('d/m/Y',$documento['NotaDebito']['DocumentoReferencia']['fecha_emision']);
					break;
				
			}?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<?php } ?>
<table width="100%" border="0"><!-- separador -->
<tr>
		<td>
		<div class="separador">&nbsp;</div>
		</td>
	</tr>
</table>
<table width="100%" border="0"><!-- datos documento -->
	<tr>
		<td width="5%">Z:<?php echo $documento['ZonaVenta']['codigo'];?></td>
		<td width="5%">
			<?php 
			switch ($codigoDocumento){
				case 107:
					echo $documento['NotaCredito']['DocumentoReferencia']['dias'];
					break;
				case 108:
					echo $documento['NotaDebito']['DocumentoReferencia']['dias'];
					break;
				default:
					echo $documento[$modelo]['dias'];
			}
			?> dias</td>
		<td width="9%">
		<?php 
			if($codigoDocumento==101 || $codigoDocumento==103){
				if($documento[$modelo]['dias']==0){
					echo "CONTADO";
				}else{
					if($documento[$doc]['especial']==1){
						echo "C-ENTREGA";
					}else{ 
						echo "CREDITO";
					}
				}
			};
			if($codigoDocumento==107){
				if($documento['NotaCredito']['DocumentoReferencia']['dias']==0){
					echo "CONTADO";
				}else{
					if($documento['NotaCredito']['DocumentoReferencia']['dias']==1){
						echo "C-ENTREGA";
					}else{ 
						echo "CREDITO";
					}
				}
			};
			if($codigoDocumento==108){
				if($documento['NotaDebito']['DocumentoReferencia']['dias']==0){
					echo "CONTADO";
				}else{
					if($documento['NotaDebito']['DocumentoReferencia']['dias']==1){
						echo "C-ENTREGA";
					}else{ 
						echo "CREDITO";
					}
				}
			};
			
		?> 
		</td>
		<td width="10%">
			<?php
				switch ($codigoDocumento){
					case 107:
						echo  $time->format('d/m/Y',$documento[$modelo]['fecha_emision']);
						break;
					case 108:
						echo  $time->format('d/m/Y',$documento[$modelo]['fecha_emision']);
						break;
					default:
						echo  $time->format('d/m/Y',$documento[$modelo]['fecha_emision']);
				}
			?>
		</td>
		<td width="11%">
			<?php 
				switch ($codigoDocumento){
					case 107:
						echo  $fechaPago;
						break;
					case 108:
						echo  $time->format('d/m/Y',$documento[$modelo]['fecha_pago']);
						break;
					default:
						echo $time->format('d/m/Y',$documento[$modelo]['fecha_pago']);
				}
			?>		
		</td>
		<td width="34%"><?php echo $documento[$modelo]['nombre_vendedor'];?></td>
		<td width="11%"><?php echo $documento[$modelo]['numero_control'];?></td>
		<td width="11%"><?php 
			if($tipoDoc == 103 ){ echo $documento['Boleta']['numero_pedido'];}
			if($tipoDoc == 101 ){ echo $documento['Factura']['numero_pedido'];}
		?></td>
		<td><?php
		if($tipoDoc == 103 || $tipoDoc == 101 ){
			echo  $time->format('d/m/Y',$documento[$modelo]['fecha_entrega']);
		}
		 ?></td>
	</tr>
</table>
<table width="100%" border="0"><!-- separador -->
  <tr>
    <td>
	<div class="separador"></div>
	</td>
  </tr>
</table>
<div id="detalle"><!-- detalles -->
<table width="100%" border="0">
<?php 
	$perc='';
	$text1='';
	$text2='';
	$e_igv='';
foreach($documento['DocumentoVentaDetalle'] as $detalle){ //detalles de los documento de ventas
?>
	<tr>
            <td width="7%">
                <?php echo $detalle['Producto']['codigo']; ?>
            </td>
            <td width="34%">
                <?php echo $detalle['descripcion_producto'];
					if($detalle['Producto']['con_percepcion']==1){
						echo '**';
						$perc="Percepcion IGV S/. ".number_format($documento['DocumentoVenta']['suma_percepcion'],2,'.','').' '.'<br>(**) afecto a percepción';
					}
					if($detalle['Producto']['exonerado_igv']==1){
						echo '*';
						$e_igv='<br>(*) exonerado de IGV';
					}
				?>
            </td>
            <td width="9%">
                <?php 
				if($detalle['Producto']['codigo']=='10900800900'){
					if($tipoDoc == 107 || $tipoDoc == 108){
						echo number_format($detalle['cantidad'],2,'.','');
					}
				}else{
					echo number_format($detalle['cantidad'],2,'.','');?> <?php echo $detalle['Producto']['UnidadMedida']['simbolo'];
				} ?>
            </td>
            <td width="12%">
                <?php 
				if($detalle['Producto']['codigo']=='10900800900'){
					if($tipoDoc == 107 || $tipoDoc == 108){
						if($documento[$doc]['DocumentoReferencia']['codigo_documento_id'] == 103){
							echo number_format(($detalle['valor_venta_unidad']*($detalle['Producto']['exonerado_igv']?1:$impuesto)),2,'.','');
						}
						if($documento[$doc]['DocumentoReferencia']['codigo_documento_id'] == 101){
							echo number_format($detalle['valor_venta_unidad'],4,'.','');
						}
					}				
				}else{
				if($tipoDoc == 103){
                    echo number_format((number_format($detalle['importe_total'],2,'.','')/number_format($detalle['cantidad'],2,'.','')),4,'.','');
                } 
				if($tipoDoc == 101){
                    echo number_format($detalle['valor_venta_unidad'],4,'.','');
                }
				if($tipoDoc == 107 || $tipoDoc == 108){
					if($documento[$doc]['DocumentoReferencia']['codigo_documento_id'] == 103){
						echo number_format(($detalle['valor_venta_unidad']*($detalle['Producto']['exonerado_igv']?1:$impuesto)),2,'.','');
					}
					if($documento[$doc]['DocumentoReferencia']['codigo_documento_id'] == 101){
						echo number_format($detalle['valor_venta_unidad'],4,'.','');
					}
				}
					}
				?>
            </td>
            <td width="12%">
                <?php echo $detalle['descuento_unidad']; ?></td>
            <td width="14%">
                <?php 
				if($tipoDoc == 103){
					echo $documento['Moneda']['simbolo']; 
					echo number_format($detalle['importe_total'],2,'.','');
				}else{
					if($tipoDoc == 107 || $tipoDoc == 108){
						if($documento[$doc]['DocumentoReferencia']['codigo_documento_id'] == 103){	
							echo $documento['Moneda']['simbolo']; 
							echo number_format((($detalle['valor_venta_unidad']*($detalle['Producto']['exonerado_igv']?1:$impuesto))*($detalle['cantidad'])),2,'.','');						
						}else{
							echo $documento['Moneda']['simbolo']; 
							echo number_format($detalle['valor_venta_total'],2,'.','');
						}
					}else{
						echo $documento['Moneda']['simbolo']; 
						echo number_format($detalle['valor_venta_total'],2,'.','');
					}
				}				
				?>
            </td>
            <td width="10%">
                <?php 
				
					if($tipoDoc == 103){
						echo '0.00';
					}else{
						if($tipoDoc == 107 || $tipoDoc == 108){
							if($documento[$doc]['DocumentoReferencia']['codigo_documento_id'] == 103){
								echo '0.00';
							}else{
								echo number_format($detalle['impuesto'],2,'.','');
							}
						}else{
							echo number_format($detalle['impuesto'],2,'.','');
						}
					}
				?>
            </td>
            <td align="right">
                <?php echo number_format($detalle['importe_total'],2,'.','');?>
            </td>
	</tr>

 <?php
 $suma_cantidad += $detalle['cantidad'];
 $suma_peso += $detalle['Producto']['peso'] * $detalle['cantidad'];
 ?>
<?php };?>
<?php if($documento['DocumentoVenta']['glosa']!=''):?>
	<tr>
		<td>&nbsp;</td>
		<td><?php  echo strtoupper(str_replace("/","<br>",$documento['DocumentoVenta']['glosa']));?></td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
<?php endif;?>
<?php if($documento['DocumentoVenta']['suma_percepcion']!=0):?>

	<tr>
    	<td rowspan="2"> </td>
        <td colspan="5" rowspan="2">Operacion sujeta a percepción del IGV R.S.Nº 189-2004/SUNAT </td>
        <td>Sub-total</td>
        <td align="right" style="border-top:1px solid black;"><?php echo number_format($documento[$modelo]['suma_importe_total'],2,'.','');?></td>
    </tr>
	<tr>
	  <td>Percepcion</td>
	  <td align="right"><?php echo number_format($documento[$modelo]['suma_percepcion'],2,'.','');?></td>
	  </tr>
<?php endif; ?>
</table>
</div>
<table width="100%" border="0"><!-- totales -->
	<tr>
		<td width="3%"></td>
		<td width="29%"></td>
		<td colspan="3">
			<?php if($detalle['Producto']['codigo']=='10900800900'){
				}else{
				if($codigoDocumento==101 || $codigoDocumento==103){
					echo $suma_cantidad.' / ';  
					echo $suma_peso.'Kg.'; }
				}
			?>
		</td>
		<td width="14%"></td>
		<td width="10%"><?php if($tipoDoc == 101 ){ echo 'IGV:'.number_format($documento[$modelo]['ref_impuesto'],0).'%';} ?></td>
		<td width="2%"></td>
	</tr>
	<tr>
		<td></td>
		<td colspan="4"><?php echo $documento[$modelo]['texto']; ?>  (S.E.U.O.)</td>
		<td>
			<?php
            echo $documento['Moneda']['simbolo'];			
			if($tipoDoc == 103){
				echo number_format($documento[$modelo]['suma_importe_total'],2,'.','');
			}else{
				if($tipoDoc == 107 || $tipoDoc == 108){
					if($documento[$doc]['DocumentoReferencia']['codigo_documento_id'] == 103){
						echo number_format($documento[$modelo]['suma_importe_total'],2,'.','');
					}else{
						echo number_format($documento[$modelo]['suma_valor_venta_total'],2,'.','');
					}
				}else{
					echo number_format($documento[$modelo]['suma_valor_venta_total'],2,'.','');
				}
			}	
			?>
		</td>
		<td>
			<?php 
			if($tipoDoc == 103){
				echo '0.00';
			}else{
				if($tipoDoc == 107 || $tipoDoc == 108){
					if($documento[$doc]['DocumentoReferencia']['codigo_documento_id'] == 103){
						echo '0.00';
					}else{
						echo number_format($detalle['impuesto'],2,'.','');
					}
				}else{
					echo number_format($documento[$modelo]['suma_impuesto'],2,'.','');
				}
			} ?>
		</td>
		<td align="right"><?php echo number_format($documento[$modelo]['suma_importe_total']+$documento[$modelo]['suma_percepcion'],2,'.','');?></td>
	</tr>
	<div class="separador">

	<tr>
		<td colspan="8">&nbsp;</td>
	</tr>

	</div>
	<tr>
		<td colspan="8"></td>
	</tr>
	<tr>
		<td></td>
		<td colspan="2">		
		<?php 
			if($tipoDoc == 101 || $tipoDoc == 103){
				echo $perc.$e_igv ;
			}
			?> </td>
		<td colspan="2"><?php 			
			if($tipoDoc == 101 ){ echo "Nro Orden: ".$documento['Factura']['numero_orden'];}
		?></td>
		<td></td>
		<td colspan="2" class="sign">
		<?php 
			if($codigoDocumento==101 || $codigoDocumento==103){
				if($documento[$modelo]['dias']==0){
					echo "CONTADO";
				}else{
					if($documento[$doc]['especial']==1){
						echo "C-ENTREGA";
					}else{ 
						echo "CREDITO";
					}
				}
			};
		?>		
		</td>		
	</tr>
	<tr>
		<td ></td>
		<td colspan="2"></td>
		<td width="14%" ></td>
		<td width="18%" ></td>
		<td ></td>
		<td colspan="2" > 
		<?php   e(strtoupper($session->read('Usuario.usuario')));   ?>/
        <?php echo $time->format('h:i:s',$documento[$modelo]['fecha_impresion']);?></td>		
	</tr>
</table>

<?php }?>
<!--/////////////////////////////////////IMPRESION COMPROBANTES DE PERCEPCION///////////////////////////////////-->
<?php if ($tipoDoc ==140){  ?>
<table width="100%"  id="cabecera"><!-- cabecera , info del cliente-->
	<tr>
		<td width="7%"></td>
        <td colspan="2"> </td>
        <td width="45%">&nbsp;</td>
        <td width="4%">&nbsp;</td>	
	</tr>
    <tr>
		<td ></td>
        <td colspan="2"><?php echo $documento['Cliente']['codigo'];?> <?php echo $documento[$modelo]['nombre_cliente'];?></td>
        <td >&nbsp;</td>
        <td >&nbsp;</td>
	</tr>
    <tr>
		<td ></td>
		<td width="11%">&nbsp;</td>
        <td width="33%">&nbsp;</td>
        <td>
		<?php  
			if($documento[$modelo]['ruc_cliente']!=''){
				echo "RUC: ".$documento[$modelo]['ruc_cliente'];
			}else{
				echo $documento['TipoDocumento']['simbolo'].": ".$documento['ComprobantePercepcione']['numero_documento_cliente'] ;
			}
		?>
		</td>
        <td>&nbsp;</td>
	</tr>
    <tr>
		<td></td>
        <td>&nbsp;</td>
        <td><?php echo $time->format('d/m/Y',$documento[$modelo]['fecha_emision']); ?></td>
        <td>&nbsp;</td>
        <td><?php echo $documento[$modelo]['numero_documento'];?></td>
	</tr>
</table>
<table width="100%" border="0"><!-- separador -->
	<tr>
		<td>
		<div class="separador"></div>
		</td>
	</tr>
	  <tr>
    <td>
	<div class="separador"></div>
	</td>
  </tr>  
    <tr>
    <td>
	<div class="separador"></div>
	</td>
  </tr>  
    <tr>
    <td>
	<div class="separador"></div>
	</td>
  </tr>  
    <tr>
    <td>
	<div class="separador"></div>
	</td>
  </tr>  
</table>
<div id="detalle">							<!-- detalles -->
<table width="100%" border="0">
<?php foreach($documento['ComprobantePercepcionDetalle'] as $detalle){?>
	<tr>
		<td width="14%" align="center"><?php echo $detalle['CodigoDocumento']['simbolo']; ?></td>
		<td width="16%" align="center">
		<?php 
			$numDoc = $detalle['DocumentoVenta']['numero_documento'];
			echo substr($numDoc, 0, 3) ." - " . substr($numDoc, 3); 
		?></td>
		<td width="14%" align="center"><?php echo $time->format('d/m/Y',$detalle['DocumentoVenta']['fecha_emision']);?></td>
		<td width="16%" align="center"><?php echo $detalle['DocumentoVenta']['suma_importe_total']; ?></td>
		<td width="14%" align="center"><?php echo round($detalle['ref_percepcion']*100)/100; ?>%</td>
		<td width="14%" align="center"><?php echo $detalle['importe_percepcion']; ?></td>
		<td width="10%" align="center"><?php echo $detalle['importe_cobranza']; ?></td> 
  </tr>
 <?php
 $suma_total += $detalle['DocumentoVenta']['suma_percepcion'];

 ?>
<?php };?>
</table>
</div>
<table width="100%" border="0"><!-- separador -->
	<tr>
		<td>
		<div class="separador"></div>
		</td>
	</tr>
	  <tr>
    <td>
	<div class="separador"></div>
	</td>
  </tr>  
    <tr>
    <td>
	<div class="separador"></div>
	</td>
  </tr>  
    <tr>
    <td>
	<div class="separador"></div>
	</td>
  </tr>  
    <tr>
    <td>
	<div class="separador"></div>
	</td>
  </tr>  
</table>
<table width="100%" border="0"><!-- totales -->
	<tr>
		<td width="14%" align="center"></td>
		<td align="center">Control: <?php echo $documento[$modelo]['numero_control'];?></td>
		<td width="14%" align="center"></td>
		<td width="14%" align="center"></td>
		<td width="14%" align="center">S/. <?php echo number_format($documento[$modelo]['suma_importe_percepcion'], 2, '.', '');?></td>
		<td width="14%" align="center"></td> 
	</tr>
		<tr>
		<td width="14%" align="center"></td>
		<td align="center"> <?php   e(strtoupper($session->read('Usuario.usuario')));   ?></td>
		<td width="14%" align="center"></td>
		<td width="14%" align="center"></td>
		<td width="14%" align="center"></td>
		<td width="14%" align="center"></td> 
	</tr>
</table>

<?php }?>
<!--/////////////////////////////////////IMPRESION COMPROBANTES DE RETENCION///////////////////////////////////-->
<?php if ($tipoDoc == 120):?>
    <table width="100%" ><!-- cabecera , info del cliente-->
            <tr>
                    <td width="10%"></td>
                    <td colspan="2"> </td>
                    <td width="16%">&nbsp;</td>
                    <td width="4%">&nbsp;</td>
            </tr>
            <tr>
                    <td ></td>
                    <td colspan="2"><?php echo $documento[$modelo]['nombre_proveedor'];?></td>
                    <td >&nbsp;</td>
                    <td >&nbsp;</td>
            </tr>
            <tr>
                    <td ></td>
                    <td width="10%">&nbsp;</td>
                    <td width="60%" align="center"><?php echo "RUC: ".$documento[$modelo]['codigo_proveedor'];?></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
            </tr>
            <tr>
                    <td></td>
                    <td><?php echo $time->format('d/m/Y',$documento[$modelo]['fecha_emision']); ?></td>
                    <td>Direcci&oacute;n: <?php echo $documento[$modelo]['direccion_proveedor'];?></td>
                    <td><?php echo $documento[$modelo]['numero_documento'];?></td>
                    <td>&nbsp;</td>
            </tr>
    </table>
    <table width="100%" border="0"><!-- separador -->
            <tr><td><div class="separador"></div></td></tr>
            <tr><td><div class="separador"></div></td></tr>
            <tr><td><div class="separador"></div></td></tr>
            <tr><td><div class="separador"></div></td></tr>
            <tr><td><div class="separador"></div></td></tr>
    </table>
    <div id="detalle">							<!-- detalles -->
    <table width="100%" border="0">
    <?php
    $suma_retencion = $suma_total = 0;
    foreach($documento['ComprobanteRetencionDetalle'] as $detalle):?>
            <tr>
                    <td width="16%" align="center"><?php echo substr($detalle['codigo_documento_id'],1); ?></td>
                    <td width="16%" align="center">
                    <?php
                            $numDoc = $detalle['numero_documento'];
                            echo substr($numDoc, 0, 3) ."  " . substr($numDoc, 3);
                    ?>
                    </td>
                    <td width="14%" align="center"><?php echo $time->format('d/m/Y',$detalle['fecha_emision']);?></td>
                    <td width="16%" align="center"><?php echo number_format($detalle['monto_mn'],2,'.',''); ?></td>
                    <td width="14%" align="center"><?php echo number_format($documento[$modelo]['ref_retencion']*100/100,2,'.',''); ?>%</td>
                    <td width="14%" align="center"><?php echo number_format($detalle['retencion_mn'],2,'.',''); ?></td>
                    <td width="10%" align="center"><?php echo number_format($detalle['monto_mn']-$detalle['retencion_mn'],2,'.',''); ?></td>
        </tr>
        <?php $suma_total += $detalle['monto_mn'];
              $suma_retencion += $detalle['retencion_mn'];
        ?>
    <?php endforeach;?>
    </table>
    </div>
    <table width="100%" border="0"><!-- separador -->
            <tr><td><div class="separador"></div></td></tr>
    </table>
    <table width="100%" border="0"><!-- totales -->
            <tr>
                    <td align="center" colspan="2">SON: <?php echo $documento[$modelo]['texto'];?>  (S.E.U.O.)</td>
                    <td width="16%" align="center">&nbsp;</td>
                    <td width="14%"></td>
                    <td width="14%"></td>
                    <td width="10%" align="center">&nbsp;</td>
            </tr>
            <tr><td>&nbsp;</td>
              <td>&nbsp;</td>
              <td align="center"><?php echo number_format($documento[$modelo]['suma_importe_total_mn'],2,'.','');?></td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td align="center"><?php echo number_format($documento[$modelo]['suma_importe_total_mn']-$documento[$modelo]['suma_retencion_mn'],2,'.','');?></td>
            </tr>
            <tr>
                    <td width="25%"></td>
                    <td width="25%"></td>
                    <td></td>
                    <td></td>
                    <td>&nbsp;</td>
                    <td></td>
            </tr>          
            <tr>
                    <td></td>
                    <td><?php   e(strtoupper($session->read('Usuario.usuario')));?></td>
                    <td>&nbsp;</td>
                    <td align="right"><?php echo $documento['Moneda']['simbolo'];?></td>
                    <td><?php echo number_format($documento[$modelo]['suma_retencion_mn'],2,'.','');?></td>
                    <td></td>
            </tr>
    </table>
<?php endif;?>
<!-- ///////////////////////////////////// IMPRESION GUIA DE REMISION //////////////////////////////////// -->
<?php if ($tipoDoc ==109){  ?>
<div style="page-break-after:avoid;page-break-before:avoid" >
<table width="100%"  id="cabecera"><!-- cabecera , info del cliente-->
    <tr>
		<td width="11%"></td>
        <td width="31%"><?php echo $time->format('d/m/Y',$documento[$modelo]['fecha_emision']); ?></td>
        <td width="28%"><?php echo $time->format('d/m/Y',$documento[$modelo]['fecha_traslado']); ?></td>
        <td width="11%">&nbsp;</td>
        <td width="19%"><?php echo $documento[$modelo]['numero_documento']; ?></td>
	</tr>
    <tr>
		<td ></td>
        <td colspan="2"></td>
        <td >&nbsp;</td>
        <td >&nbsp;</td>
	</tr>
    <tr>
		<td colspan="3" >&nbsp;&nbsp;<?php  
		if($documento[$modelo]['direccion_partida']==''){ 
			e($session->read('Usuario.CentroDist.direccion'));
		}else{
			 echo $documento[$modelo]['direccion_partida'];
		}   ?></td>
		<td>&nbsp;</td>
        <td>&nbsp;</td>
	</tr>
    <tr>
		<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td colspan="2"><?php if($tipoDoc == 109 && ( substr($documentos[0][$modelo]['numero_documento'], 0,3)=='001')){
             }else{
             	if($documento[Cliente]['direccion_entrega']!=''){
			 		echo 'Pto. Entr. :'.$documento[Cliente]['direccion_entrega'];
				}else{
					echo 'Pto. Entr. :'.$documento[Cliente]['referencia'];
				} 
			}?></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>		
	</tr>
    <tr>
      <td colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $documento[$modelo]['direccion_cliente']; ?> / <?php echo $documento[Cliente]['localidad']; ?></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <?php 
	  $colspan = 1;
	  if($tipoDoc == 109 && substr($documentos[0][$modelo]['numero_documento'], 0,3)=='001'){
		$colspan = 2;
	  } else {
		echo '<td></td>';
	  }
	  ?>	  
      <td colspan="<?php echo $colspan;?>"><?php echo substr($documento['Vehiculo']['Marca']['descripcion'], 0, 5)."/ ".$documento[$modelo]['placa_vehiculo']."/ ".$documento[$modelo]['placa_remolque']; ?></td>
    </tr>
    <tr>
      <td colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $documento[$modelo]['nombre_cliente']; ?></td>
      <?php 
	  $colspan = 1;
	  if($tipoDoc == 109 && substr($documentos[0][$modelo]['numero_documento'], 0,3)=='001'){
		$colspan = 2;
	  } else {
		echo '<td></td>';
	  }
	  ?>
      <td colspan="<?php echo $colspan;?>"><?php if(!empty($documento['Vehiculo']['certificado_inscripcion'])){
					echo $documento['Vehiculo']['certificado_inscripcion'];}
				else{
					echo "TRAMITE";
				}
				?></td>
    </tr>
    <tr>
      <td></td>
      <td><?php echo $documento[$modelo]['ruc_cliente']; ?></td>
      <td><?php echo $documento[$modelo]['documento_cliente']; ?></td>
      <?php 
	  $colspan = 1;
	  if($tipoDoc == 109 && substr($documentos[0][$modelo]['numero_documento'], 0,3)=='001'){
		$colspan = 2;
	  } else {
		echo '<td></td>';
	  }
	  ?>	  	  
      <td colspan="<?php echo $colspan;?>"><?php echo $documento['Chofer']['brevete_numero'].' '.$documento['Vehiculo']['configuracion'].' '.$documento['Vehiculo']['Remolque']['configuracion']; ?></td>
    </tr>
    <tr>
      <td colspan="5"><div class="separador"></div></td>
      </tr>
</table>
<?php  if($documento[$modelo]['automatico']!=1){ ?>
<div id="detallegr">
 <?php 
if($tipoDoc == 109 && ( substr($documentos[0][$modelo]['numero_documento'], 0,3)=='001')){?>
	<table width="100%" border="0" >
<?php 	foreach($documento['GuiaRemisionDetalle'] as $detalle){?>	<!-- DETALLES DISTRIBUCION -->
 <tr>
    <td width="13%"><?php echo $detalle['Producto']['codigo'];?></td>
    <td width="70%"><?php echo $detalle['descripcion_producto'];?></td>
    <td width="8%"><?php echo number_format($detalle['cantidad'], 2, '.', ',');?></td>
    <td width="7%"><?php echo number_format($detalle['peso'], 2, '.', ',');?></td>
    <td width="2%"><?php echo 'Kg.';//$detalle['Producto']['UnidadMedida']['simbolo']?></td>
  </tr>
 <?php
 $suma_cantidad += $detalle['cantidad'];
 $suma_peso += $detalle['peso'];
 $precio_ref+= $detalle['cantidad'] * $detalle['Producto']['importe_base'];
 ?>
<?php };?>
	<tr>
		<td colspan='5'>	<?php 
	foreach($documento['GuiaRemisionDocumentoVenta']['0']['DocumentoVenta']['DocumentoVentaDetalle'] as $items){ ?>
  <table  width="70%">
  <tr>
	<td><?php echo $items['Producto']['codigo'];?></td>
	<td colspan='3'><?php echo $items['descripcion_producto'];?></td>
	<td><?php echo $items['cantidad'];?></td>
	<td><?php echo $items['Producto']['peso']*$items['cantidad'];?> kg</td>
  </tr>
  </table>
  <?php };?>
		-------------------------------------------------------------------------------------------------------------------</td>
	</tr>
    <tr>
    <td colspan="5"><?php echo 'TOTAL: '.$suma_cantidad.' PAQUETES '.$suma_peso.'Kg.  Valor Mercaderia:S./ '.$precio_ref ; ?></td>
    </tr>
</table>
<?php 	
} else {?>	
<table width="100%" border="0" >
<?php 	foreach($documento['GuiaRemisionDetalle'] as $detalle){?>	<!-- DETALLES DISTRIBUCION -->
 <tr>
    <td width="13%"><?php echo $detalle['Producto']['codigo'];?></td>
    <td width="51%"><?php echo $detalle['descripcion_producto'];?></td>
    <td width="7%"><?php echo number_format($detalle['cantidad'], 2, '.', ',');?></td>
    <td width="9%"><?php echo number_format($detalle['peso'], 2, '.', ',');?></td>
    <td width="20%"><?php echo 'Kg.';//$detalle['Producto']['UnidadMedida']['simbolo']?></td>
  </tr>
 <?php
 $suma_cantidad += $detalle['cantidad'];
 $suma_peso += $detalle['peso'];
 $precio_ref+= $detalle['cantidad'] * $detalle['Producto']['importe_base'];
 ?>
<?php };?>
	<tr>
	<?php 
	foreach($documento['GuiaRemisionDocumentoVenta']['0']['DocumentoVenta']['DocumentoVentaDetalle'] as $items){ ?>
  <table  width="70%">
  <tr>
	<td><?php echo $items['Producto']['codigo'];?></td>
	<td colspan='3'><?php echo $items['descripcion_producto'];?></td>
	<td><?php echo $items['cantidad'];?></td>
	<td><?php echo $items['Producto']['peso']*$items['cantidad'];?> kg</td>
  </tr>
  </table>
  <?php };?>
		<td colspan='5'>
		-------------------------------------------------------------------------------------------------------------------</td>
	</tr>
    <tr>
    <td colspan="5"><?php echo 'TOTAL: '.$suma_cantidad.' PAQUETES '.number_format($suma_peso, 2, '.', ',').'Kg.  Valor Mercaderia:S./ '. number_format($precio_ref, 2, '.', ','); ?></td>
    </tr>
</table>
<?php
}
?>
</div> 
<?php } else{ ?>

<div id="detalle2">
<table width="100%" border="0" >
  <tr>
    <td width="12%" align="center">NUM. DOC.</td>
    <td width="9%" align="center">F. EMISION</td>
    <td width="9%" align="center">RUC/DNI</td>
    <td width="34%" align="center">--------------ADQUIRIENTE--------------</td>
    <td width="36%" align="center">--------------DESTINO FINAL---------------</td>
  </tr>
  <?php foreach($documento['GuiaRemisionDocumentoVenta'] as $detalle){?>
  <!-- DETALLES REPARTO -->
  <tr>
    <td align="center"><?php if($detalle['tipo_documento']==101){echo "F/.";}else{echo "BV.";}?>
      <?php echo $detalle['numero_documento'];?></td>
    <td align="center"><?php echo $time->format('d/m/Y',$detalle['DocumentoVenta']['fecha_emision']); ?></td>
    <td align="center"><?php echo $detalle['DocumentoVenta']['Cliente']['Tercero']['ruc'];?></td>
    <td align="center"><?php echo $detalle['DocumentoVenta']['nombre_cliente'];?></td>
    <td align="center"><?php echo $detalle['DocumentoVenta']['direccion_cliente'];?></td>
  </tr>
  <?php };?>
	<?php if ($opc==1){
	foreach($documento['GuiaRemisionDocumentoVenta']['0']['DocumentoVenta']['DocumentoVentaDetalle'] as $items){ ?>
  <table  width="70%">
  <tr>
	<td><?php echo $items['Producto']['codigo'];?></td>
	<td colspan='3'><?php echo $items['descripcion_producto'];?></td>
	<td><?php echo $items['cantidad'];?></td>
	<td><?php echo $items['Producto']['peso']*$items['cantidad'];?> kg</td>
  </tr>
  </table>
  <?php }};?>
  <tr>
    <td colspan='5'>     
    --------------------------------------------------------------------------------------------------------- </td>
  </tr>
  <tr>
    <td> TOTAL: </td>
    <td colspan="3"><table>
      <?php 
			$pesoTotal=0;
			foreach($unidades as $k=>$v){ ?>
      <tr>
        <td><?php echo number_format($v['cantidad'], 2, '.', ',');//cantidad por tipo de unidad?></td>
        <td><?php echo $k.'; ';//tipo de unidad?></td>
        <td><?php echo number_format($v['peso'], 2, '.', ',').' kg';//peso por tipo de unidad?></td>
      </tr>
      <?php 
			$pesoTotal+=$v['peso'];
		} ?>
    </table></td>
    <td colspan="1"> PESO TOTAL: <?php echo number_format($pesoTotal, 2, '.', ',').'kg';//peso por tipo de unidad?></td>
  </tr>
  <tr>
    <td colspan="5"><div class="separador"></div></td>
  </tr>
  <tr>
    <td colspan="5"><div class="separador"></div></td>
  </tr>
</table>
</div>
<?php } ?>
<table width="100%" border="0"><!-- datos transportista -->
  <tr>
    <td width="40%">&nbsp;</td>
    <td width="40%"><?php echo $documento['Transportista']['Tercero']['razon_social'];?></td>
    <td width="20%">&nbsp;</td>
    <td><?php echo $documento['Transportista']['Tercero']['ruc'];?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="3"><?php echo $documento['Transportista']['Tercero']['direccion'];?></td>    
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<div id="bottomMarginCP"></div>
</div>
<?php }?>
<?php if ($tipoDoc ==999){				
		if($_SESSION['Usuario']['CentroDist']['id'] == '50' ){	
?>
<div id="topConstancia"></div>
<table width="90%" border="0" style="page-break-inside:avoid">
  
  <tr>
    <td width="17%">&nbsp;</td>
    <td width="12%">&nbsp;</td>
    <td width="11%">&nbsp;</td>
    <td width="9%">&nbsp;</td>
    <td width="8%">&nbsp;</td>
    <td width="8%">&nbsp;</td>
    <td width="8%">&nbsp;</td>
    <td width="9%">&nbsp;</td>
    <td width="6%">&nbsp;</td>
    <td width="12%"><span class="sign"><?php echo $documento[$modelo]['numero_control']; ?></span></td>
  </tr>
  <tr>
    <td colspan="10">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="10">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="9"><?php echo $razon_social.' - '.$centroDist['CentroDist']['descripcion']; ?></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="4"><?php echo $documento['Origen']['direccion']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $ruc; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;052- 413044</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><?php echo $distrito; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $provincia; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $departamento; ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="4">&nbsp;&nbsp;&nbsp;<?php echo $documento[$modelo]['guias']; ?></td>
    <td>&nbsp;</td>
    <td><?php echo $documento[$modelo]['fecha_guias']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $documento[$modelo]['manifiesto_carga']; ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2"><?php echo $documento[$modelo]['numero_factura']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo ($documento[$modelo]['fecha_factura'] != '00/00/0000')?$documento[$modelo]['fecha_factura']:''; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo ($documento[$modelo]['fecha_manifiesto'] != '00/00/0000')?$documento[$modelo]['fecha_manifiesto']:''; ?></td>
  </tr>
  <tr>
    <td colspan="10" height="30px">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="4"><?php echo $documento[$modelo]['origen_direccion']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $documento[$modelo]['fecha_salida']; ?></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="4"><?php echo $documento[$modelo]['destino_direccion']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $documento[$modelo]['fecha_llegada']; ?></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="10" style="height:	85pt;">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="8">
    <table width="100%" border="0">
  <tr>
 	<td width="15%"><?php echo $documento['Vehiculo']['Marca']['descripcion']; ?></td>
    <td width="14%"><?php echo $documento['Vehiculo']['matricula']; ?></td>
    <td width="15%"><?php echo $documento['Vehiculo']['largo']; ?></td>
    <td width="13%"><?php echo $documento['Vehiculo']['ancho']; ?></td>
    <td width="13%"><?php echo $documento['Vehiculo']['alto']; ?></td>
    <td width="8%"><?php echo $documento['Vehiculo']['cantidad_ejes']; ?></td>
    <td width="8%"><?php echo $documento['Vehiculo']['cantidad_ruedas']; ?></td>
    <td width="14%" align="right"><?php echo $documento['Vehiculo']['peso_seco']; ?></td>
  </tr>
</table>
    </td>
    </tr>
  <tr>
    <td colspan="10" style="height:	65pt;">&nbsp;</td>
  </tr>
  <tr>
    <td align="center"> <?php echo ' '.$documento['Remolque']['matricula']; ?> </td>
    <td colspan="4"><?php echo $documento[$modelo]['descripcion_remolque'];
	 //echo $documento['Remolque']['Carroceria']['descripcion']; echo $documento['Remolque']['color']; ?></td>
    <td colspan="5"><table width="100%" border="0">
      <tr>
        <td width="25%">&nbsp;</td>
        <td width="22%"><?php echo $documento['Remolque']['largo']; ?></td>
        <td width="17%"><?php echo $documento['Remolque']['ancho']; ?></td>
        <td width="14%"><?php echo $documento['Remolque']['alto']; ?></td>
        <td width="22%" align="right"><?php echo $documento['Remolque']['peso_seco']; ?></td>
        </tr>
</table></td>
    </tr>
  <tr>
    <td colspan="10" style="height:	50pt;">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="9"><table width="100%" border="0">
  <tr>
 	<td width="13%" ><?php echo $documento[$modelo]['peso_eje1']; ?></td>
    <td width="13%" ><?php echo $documento[$modelo]['peso_eje2']; ?></td>
    <td width="13%" ><?php echo $documento[$modelo]['peso_eje3']; ?></td>
    <td width="13%" ><?php echo $documento[$modelo]['peso_eje4']; ?></td>
    <td width="13%"><?php echo $documento[$modelo]['peso_eje5']; ?></td>
    <td width="13%"><?php echo $documento[$modelo]['peso_eje6']; ?></td>
    <td width="13%"><?php echo $documento[$modelo]['peso_eje7']; ?></td>
    <td width="12%" align="right"><?php echo $documento[$modelo]['peso_total']; ?></td>
  </tr>
</table></td>
    </tr>
  <tr>
    <td colspan="10">&nbsp;</td>
    </tr>
     <tr>
    <td colspan="10">&nbsp;</td>
  </tr>
   <tr>
    <td colspan="10">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="10">&nbsp;</td>
    </tr>
  <tr>
  <td colspan="10">&nbsp;</td>
    </tr>
   <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="7"><?php echo $documento[$modelo]['observaciones']; ?></td>
    </tr>
  
</table>
<?php 
	} else{ ?>
	<div id="topConstancia"></div>
<table width="90%" border="0" style="page-break-inside:avoid">
  
  <tr>
    <td width="17%" height="45px">&nbsp;</td>
    <td width="12%">&nbsp;</td>
    <td width="11%">&nbsp;</td>
    <td width="9%">&nbsp;</td>
    <td width="8%">&nbsp;</td>
    <td width="8%">&nbsp;</td>
    <td width="8%">&nbsp;</td>
    <td width="9%">&nbsp;</td>
    <td width="6%">&nbsp;</td>
    <td width="12%"><span class="sign"><?php echo $documento[$modelo]['numero_control']; ?></span></td>
  </tr>
  <tr>
    <td colspan="10" height="20px">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="9"><?php echo $razon_social.' - '.$centroDist['CentroDist']['descripcion']; ?></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="4"><?php echo $documento['Origen']['direccion']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $ruc; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;052- 413044</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><?php echo $distrito; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $provincia; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $departamento; ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="4">&nbsp;&nbsp;&nbsp;<?php echo $documento[$modelo]['guias']; ?></td>
    <td>&nbsp;</td>
    <td><?php echo $documento[$modelo]['fecha_guias']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $documento[$modelo]['manifiesto_carga']; ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2"><?php echo $documento[$modelo]['numero_factura']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo ($documento[$modelo]['fecha_factura'] != '00/00/0000')?$documento[$modelo]['fecha_factura']:''; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo ($documento[$modelo]['fecha_manifiesto'] != '00/00/0000')?$documento[$modelo]['fecha_manifiesto']:''; ?></td>
  </tr>
  <tr>
    <td colspan="10" height="30px">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="4"><?php echo $documento[$modelo]['origen_direccion']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $documento[$modelo]['fecha_salida']; ?></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="4"><?php echo $documento[$modelo]['destino_direccion']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?php echo $documento[$modelo]['fecha_llegada']; ?></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="10" style="height:	67pt;">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="8">
    <table width="100%" border="0">
  <tr>
 	<td width="15%"><?php echo $documento['Vehiculo']['Marca']['descripcion']; ?></td>
    <td width="14%"><?php echo $documento['Vehiculo']['matricula']; ?></td>
    <td width="15%"><?php echo $documento['Vehiculo']['largo']; ?></td>
    <td width="13%"><?php echo $documento['Vehiculo']['ancho']; ?></td>
    <td width="13%"><?php echo $documento['Vehiculo']['alto']; ?></td>
    <td width="8%"><?php echo $documento['Vehiculo']['cantidad_ejes']; ?></td>
    <td width="8%"><?php echo $documento['Vehiculo']['cantidad_ruedas']; ?></td>
    <td width="14%" align="right"><?php echo $documento['Vehiculo']['peso_seco']; ?></td>
  </tr>
</table>
    </td>
    </tr>
  <tr>
    <td colspan="10" style="height:	50pt;">&nbsp;</td>
  </tr>
  <tr>
    <td align="center"> <?php echo ' '.$documento['Remolque']['matricula']; ?> </td>
    <td colspan="4"> <?php echo $documento[$modelo]['descripcion_remolque'];
	 //echo $documento['Remolque']['Carroceria']['descripcion']; echo $documento['Remolque']['color']; ?></td>
    <td colspan="5"><table width="100%" border="0">
      <tr>
        <td width="25%">&nbsp;</td>
        <td width="22%"><?php echo $documento['Remolque']['largo']; ?></td>
        <td width="17%"><?php echo $documento['Remolque']['ancho']; ?></td>
        <td width="14%"><?php echo $documento['Remolque']['alto']; ?></td>
        <td width="22%" align="right"><?php echo $documento['Remolque']['peso_seco']; ?></td>
        </tr>
</table></td>
    </tr>
  <tr>
    <td colspan="10" style="height:	55pt;">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="9"><table width="100%" border="0">
  <tr>
 	<td width="13%"><?php echo $documento[$modelo]['peso_eje1']; ?></td>
    <td width="13%"><?php echo $documento[$modelo]['peso_eje2']; ?></td>
    <td width="13%"><?php echo $documento[$modelo]['peso_eje3']; ?></td>
    <td width="13%"><?php echo $documento[$modelo]['peso_eje4']; ?></td>
    <td width="13%"><?php echo $documento[$modelo]['peso_eje5']; ?></td>
    <td width="13%"><?php echo $documento[$modelo]['peso_eje6']; ?></td>
    <td width="13%"><?php echo $documento[$modelo]['peso_eje7']; ?></td>
    <td width="12%" align="right"><?php echo $documento[$modelo]['peso_total']; ?></td>
  </tr>
</table></td>
    </tr>
  <tr>
    <td colspan="10">&nbsp;</td>
    </tr>
     <tr>
    <td colspan="10">&nbsp;</td>
  </tr>
   <tr>
    <td colspan="10">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="10">&nbsp;</td>
    </tr>
  <tr>
  <td colspan="10">&nbsp;</td>
    </tr>
   <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="7"><?php echo $documento[$modelo]['observaciones']; ?></td>
    </tr>
  
</table>	
	<?php
	}
}?>
<?php if ($tipoDoc ==888){  ?>
<table width="100%" border="0">
  <tr>
    <td colspan="3">CORPORACION ADC S.A.C</td>
    <td width="20%">&nbsp;</td>
    <td colspan="3">&nbsp;</td>
    <td width="7%">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2">CAJA</td>
    <td width="18%">&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="3">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
    <td>&nbsp;</td>
    <td align="center"><?php echo $documentos['DocumentoBancario']['titulo']?></td>
    <td width="10%">&nbsp;</td>
    <td width="13%">&nbsp;</td>
    <td width="12%">Voucher : </td>
    <td style="font-size:10pt"><?php echo $documentos['DocumentoBancario']['libro'].'.'.$documentos['DocumentoBancario']['periodo_id'].'.'.$documentos['DocumentoBancario']['numero_comprobante']; ?></td>
  </tr>
  <tr>
    <td width="11%">&nbsp;</td>
    <td width="9%">&nbsp;</td>
    <td>&nbsp;</td>
    <td align="center">-------------------------</td>
    <td colspan="2">&nbsp;</td>
    <td colspan="2"><pre>----------------------------</pre></td>
    </tr>
  <tr>
    <td colspan="7"><?php echo $documentos['DocumentoBancario']['pagar_a']; ?></td>
    <td>T.C. :<?php echo $documentos['DocumentoBancario']['tipo_cambio']; ?></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="3" align="center">---------------CUENTAS CONTABLES---------------</td>
    </tr>
  <tr>
    <td>Nombre:</td>
    <td colspan="4"><?php echo $documentos['DocumentoBancario']['descripcion_proveedor']; ?></td>
    <td colspan="3" rowspan="10" valign="top">
		<table width="100%" border="0">
			<?php 
				foreach($documentos['DocumentoBancarioDetalle'] as $detalle){
			?>
		  <tr>
			<td colspan="2"><?php echo $detalle['cuenta_id'].' '.$detalle['codigo_proveedor'].' '.$detalle['codigo_documento_id'].' '.$detalle['numero_documento']; ?></td>
			<td width="25%" align="right"><?php echo number_format($detalle['importe_operacion']*$documentos['DocumentoBancario']['tipo_cambio'],2, '.', ','); ?></td>
		  </tr>
		  <?php } ?>
		  <tr>
			<td width="42%">&nbsp;</td>
			<td width="33%">&nbsp;</td>
			<td align="right">-----------------</td>
		  </tr>
		  <tr>
			<td>&nbsp;</td>
			<td>Total en S/. -></td>
			<td align="right"><?php echo number_format($documentos['DocumentoBancario']['importe']*$documentos['DocumentoBancario']['tipo_cambio'],2, '.', ','); ?></td>
		  </tr>
		</table>
	</td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
  <tr>
    <td>Concepto</td>
    <td colspan="2"><?php echo $documentos['DocumentoBancario']['observaciones']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
  <tr>
    <td>Proveedor</td>
    <td colspan="4"><?php echo $documentos['DocumentoBancario']['descripcion_proveedor']; ?></td>
    </tr>
  <tr>
    <td>Importe</td>
    <td colspan="2"><?php echo $documentos['CuentaBancaria']['Moneda']['simbolo']; ?> <?php echo number_format($documentos['DocumentoBancario']['importe'],2, '.', ','); ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <?php
		if($documentos['DocumentoBancario']['total_retencion']>0){
	?>
  <tr>
    <td>Retencion IGV</td>
    <td colspan="2"><?php echo $documentos['DocumentoBancario']['numero_retencion']; ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
  <tr>
  <?php	} 	?>
    <td>Nro <?php echo $documentos['DocumentoBancario']['titulo2']?></td>
    <td colspan="2"><?php echo $documentos['DocumentoBancario']['numero_documento']; ?></td>
    <td colspan="2"><?php
                        $date 	= $session->read('Ejercicio.Actual.fecha');
						$ubi	= $session->read('Usuario.CentroDist.ciudad');
                        if ($date)
                            $date = split('/', $date);
                        else
                            $date = split('/', date('d/m/Y'));
                        $date = mktime(0, 0, 0, $date[1], $date[0], $date[2]);
                        $dias = array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sábado");
                        $meses = array("","ENERO","FEBRERO","MARZO","ABRIL","MAYO","JUNIO","JULIO","AGOSTO","SEPTIEMBRE","OCTUBRE","NOVIEMBRE","DICIEMBRE");
                        echo $ubi.", ".date('j', $date)." de ".$meses[date('n', $date)]." del ".date('Y', $date);
                    ?></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
  <tr>
    <td>------------</td>
    <td>--------------</td>
    <td>----------------</td>
    <td>--------------------------</td>
    <td>&nbsp;</td>
    </tr>
  <tr>
    <td>Hecho por</td>
    <td>Contador</td>
    <td>Gerencia</td>
    <td>Recibí Conforme</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php e(strtoupper($session->read('Usuario.usuario')));   ?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>Nombre:_____________</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>DNI:________________</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="23">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>Fecha:_______________</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="8"><?php echo $documentos['Proveedore']['cuenta_bancaria1']; ?></td>
    </tr>
</table>
<?php 
break;
}?>

</div>
<?php $i++ ;};?>
<script type="text/javascript">
 $(function(){
    window.print();
    setTimeout(window.close,1000);
});
</script>